<ul class="button">
    <li><a href="javascript:void(0);" class="add">上传图片</a></li>
</ul>

<div class="records">
    <div class="albums">
        <select name="album">
            <?php foreach ($albums as $album): ?>
                <option value="<?php echo $album->id; ?>"><?php echo $album->name; ?></option>
            <?php endforeach; ?>
        </select>
        <a href="javascript:void(0);" class="select-all">全选</a>
        <a href="javascript:void(0);" class="delete-batch">批量删除</a>
    </div>
    <ul class="records"></ul>
    <div class="page-links"></div>
</div>

<script id="list-template" type="text/x-jquery-tmpl">
    <li class="photo">
        <a href="javascript:void(0);" class="show" title="thisff">
            <img src="/assets/uploads/${$item.thumbFile(file_name)}" onerror="window.imageError(this);" onload="window.alignImage(this,150,150);"/>
        </a>
        <div class="label">
            <input type="checkbox" value="${id}"/>
            ${label}
        </div>
        <div class="action">
            <a href="javascript:void(0);" class="edit">修改</a>
            <a href="javascript:void(0);" class="delete">删除</a>
        </div>
    </li>
</script>

<script id="form-template" type="text/x-jquery-tmpl">
    <form action="/backend/photo/${action}" target="insert-iframe" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="${id}"/>
        <div class="form-row">
            <label for="album">相册</label>
            <select name="album">
                <?php foreach ($albums as $album): ?>
                    <option value="<?php echo $album->id; ?>"><?php echo $album->name; ?></option>
                <?php endforeach; ?>
            </select>
        </div>
        <div class="form-row">
            <label for="label">标签</label>
            <input type="text" name="label" value="${label}"/>
        </div>
        {{if action=="insert"}}
        <div class="form-row">
            <label for="photo">选择图片</label>
            <input type="file" name="photo" />
        </div>
        {{/if}}
        <div class="form-button">
            <input type="submit" name="submit" value="上传"/>
        </div>
        <iframe name="insert-iframe" style="display:none;"></iframe>
    </form>
</script>